package com.github.poplar.monitortoolservice.operationsys;

import com.github.poplar.monitortooapi.OperationSysInterface;
import com.github.poplar.monitortooapi.vo.OperationSysVO;
import lombok.Data;
import org.springframework.stereotype.Service;

import java.util.Properties;

/**
 * @description: 计算机系统服务
 * @author: hkai
 * @date: 2022/1/9 9:26 下午
 * @version: 1.0
 */
@Data
@Service
public class OperationSysService implements OperationSysInterface {

    /**
     * 计算机系统信息
     * @return
     */
    @Override
    public OperationSysVO OperationSysInfo() {
        Properties props = System.getProperties();
        String userName = props.getProperty("user.name");
        String userCountry = props.getProperty("user.country");
        String osName = props.getProperty("os.name");
        String osArch = props.getProperty("os.arch");
        String userDir = props.getProperty("user.dir");
        OperationSysVO sysVO = new OperationSysVO();
        sysVO.setComputerName(userName);
        sysVO.setCountry(userCountry);
        sysVO.setOsName(osName);
        sysVO.setOsArch(osArch);
        sysVO.setUserDir(userDir);
        return sysVO;
    }
}
